import { LoaderHelp } from "../../../../../common/display/LoaderHelp";
import { ResFileConst } from "../../../../resource/ResFileConst";
import { ItemData } from "../../../../resource/info/ItemData";
import { ToolTipsManager } from "../../../../../../com/mui/manager/ToolTipsManager";
import { BaseItem } from "../../../common/BaseItem";
import { ItemsUtil } from "../../../shortcuts/item/ItemsUtil";
import { GlobalClass } from "../../../../../../com/mui/core/GlobalClass";
import { ImagesConst } from "../../../../resource/ImagesConst";
import { ObjCreate } from "../../../common/ObjCreate";
import { GTextFiled } from "../../../../../../com/mui/controls/GTextFiled";
//class SkillRuneComposeTargetItem
    
    export  class SkillRuneComposeTargetItem /* flash.display.Sprite */
    {
        constructor()
        {
            
            LoaderHelp.addResCallBack(ResFileConst.rune, this.initView);
            return;
        }

        public update(arg1: ItemData): void
        {
            this._data = arg1;
            if (!(this._item == null) && !(this._item.parent == null)) 
            {
                this._item.parent.removeChild(this._item);
            }
            if (arg1 == null) 
            {
                this.enabledDetial(false);
                return;
            }
            this.enabledDetial(true);
            this._txtName.htmlText = arg1.htmlName;
            if (this._item != null) 
            {
                ToolTipsManager.unregister(this._item);
            }
            this._item = new BaseItem();
            this._item.isShowLock = ItemsUtil.isBind(this._data);
            this._item.itemData = this._data;
            this._item.amount = 1;
            this._item.width = 60;
            this._item.height = 60;
            this._item.isDragAble = false;
            this._item.isDropAble = false;
            this.addChild(this._item);
            return;
        }

        /* internal  */enabledDetial(arg1: Boolean=false): void
        {
            this._bt.visible = arg1;
            this._txtName.visible = arg1;
            return;
        }

        /* internal  */initView(): void
        {
            var loc1=null;
            this._bt = new Object /* flash.display.Bitmap */();
            this._bt.x = -18;
            this._bt.y = 65;
            this.addChild(this._bt);
            this._bt.bitmapData = GlobalClass.getBitmap(ImagesConst.SkillRuneHolyBg).bitmapData;
            this._bt.visible = false;
            loc1 = ObjCreate.createBg(0, 0, 64, 64, this);
            loc1.x = -3;
            loc1.y = -3;
            this._txtName = ObjCreate.createGTextField("", -18, this._bt.y + 5, this._bt.width, 20, this);
            this._txtName.textColor = 16711927;
            var loc2=this._txtName.defaultTextFormat;
            loc2.align = flash.text.TextFormatAlign.CENTER;
            loc2.size = 14;
            loc2.bold = true;
            this._txtName.defaultTextFormat = loc2;
            return;
        }

        /* internal */ /* var */_data: ItemData;

        /* internal */ /* var */_bt: Object /* flash.display.Bitmap */;

        /* internal */ /* var */_txtName: GTextFiled;

        /* internal */ /* var */_item: BaseItem;
    }
